{extend name="layout"}
{block name="detail"}
<header class="aui-header-default aui-header-fixed aui-header-bg">
    <a href="javascript:history.back(-1)" class="aui-header-item" style="visibility:hidden;">
        <i class="aui-icon aui-icon-back-white"></i>
    </a>
    <div class="aui-header-center aui-header-center-clear">
        <div class="aui-header-center-logo">
            <div class="aui-car-white-Typeface">添加商品</div>
        </div>
    </div>
    <a href="#" class="aui-header-item-icon" style="min-width:0;visibility:hidden;">
        <i class="aui-icon aui-icon-share-pd"></i>
    </a>
</header>
<style>
    .ssss img{max-width:100%;}
</style>
<div class="aui-content-box" style="padding:10px;margin-top: 44px;">
    <form class="form-horizontal" method="post" action="{:url('index/shop/saveProduct')}" enctype="multipart/form-data" id="pFrom">
        <input type="hidden" name="id" value="{$product.id}">
        <div class="form-group row">
            <label for="title" class="col-sm-2 form-control-label">商品标题</label>
            <div class="col-sm-9">
                <input id="title" type="text" required name="title" value="{$product.title}"  class="form-control">
            </div>
        </div>

        <div class="form-group row">
            <label for="img" class="col-sm-2 form-control-label">请上传产品图片</label>
            <div class="col-sm-9">
                <img src="{$product.img}" alt="" width="50" class="bdimg">
                <input id="img" type="file"  name="img" accept="image/*" multiple>
            </div>
        </div>
        <div class="form-group row">
            <label  class="col-sm-2 form-control-label">是否上架</label>
            <div class="col-sm-9">
                <input  type="radio" required name="isShow"  value="1" {if condition="$product['isShow'] eq 1"}checked{/if}>是
                <input  type="radio" required name="isShow" value="0" {if condition="$product['isShow'] eq 0"}checked{/if}>否
            </div>
        </div>

        <div class="form-group row">
            <label  class="col-sm-2 form-control-label">商品详情</label>
            <div class="col-sm-9">
                <script id="container" name="info" type="text/plain">{$product.info}</script>
            </div>
        </div>
        <p style="line-height: 40px">*系统建议代理利润不低于{$min_profit}%</p>
        {for start="1" end="10"}
        {if condition="isset($guige[$i-1])"}
        <div class="form-group row">
            <div class="col-sm-4 col-xs-4">
                商品规格： <input id="guige[]" type="text"  name="guige[]" value="{$guige[$i-1]['guige']}"  class="form-control">
            </div>

            <div class="col-sm-4 col-xs-4">
                商品卖价 <input id="salePrice[]" type="text"  name="salePrice[]" value="{$guige[$i-1]['salePrice']}" class="form-control">
            </div>

            <div class="col-sm-4 col-xs-4">
                商品代理价<input id="agentPrice[]" type="text"  name="agentPrice[]" value="{$guige[$i-1]['agentPrice']}" class="form-control agentPrice">
            </div>
        </div>
        {else}
        <div class="form-group row">

            <div class="col-sm-4 col-xs-4">
                商品规格： <input id="guige[]" type="text"  name="guige[]"   class="form-control">
            </div>

            <div class="col-sm-4 col-xs-4">
                商品卖价 <input id="salePrice[]" type="text"  name="salePrice[]"  class="form-control">
            </div>

            <div class="col-sm-4 col-xs-4">
                商品代理价<input id="agentPrice[]" type="text"  name="agentPrice[]"  class="form-control agentPrice">
            </div>
        </div>
        {/if}
        {/for}
        <div class="form-group row">
            <div class="text-center">
                <button type="submit" class="btn" style="background-color: #f55d22;color: white;width: 100px">保存</button>
            </div>
        </div>
    </form>
</div>
<div style="height:100px;"></div>
<script type="text/javascript" src="__STATIC__/ueditor/ueditor.config.js"></script>
<!-- 编辑器源码文件 -->
<script type="text/javascript" src="__STATIC__/ueditor/ueditor.all.js"></script>
<!-- 实例化编辑器 -->
<script type="text/javascript">
    var ue = UE.getEditor('container',{
        autoHeightEnabled: true,
        autoFloatEnabled: true,
        allowDivTransToP: false,
        initialFrameHeight:350,
    });
</script>
{/block}